package com.fgba.express.core.controller.handle;

import com.fgba.express.comm.exception.BizException;
import com.fgba.express.comm.result.ResultCode;
import com.fgba.express.core.entity.BaseEntity;
import com.fgba.express.core.dto.BaseDto;
import com.fgba.express.util.NullChecker;

public interface ControllerValidationHandle<T extends BaseEntity, D extends BaseDto> {
    default void createValidation(D model) {

    }

    default void updateValidation(D model) {
        if (NullChecker.isNullOrZero(model.getId())) {
            throw new BizException(ResultCode.USER_REQUEST_PARAM_IS_BLANK);
        }
    }
}
